<h1>Inserindo reserva</h1>

<% form_for(@reserva) do |f| %>
  <%= f.error_messages %>
<% if session[:admin] %>
  <p>
    <%= f.label :hospede %><br />
    <%= f.select("hospede_id", Hospede.find(:all, :order => "nome").collect {|h| [ h.nome, h.id ] }, {}) %>
  </p>
<% else %>
    <%= f.hidden_field "hospede_id", :value => session[:id] %>
<% end %>
  <p>
    <%= f.label :tiposApartamento_id, "Tipo de apartamento"%><br />
    <%= f.select("tiposApartamento_id", TiposApartamento.all.collect {|t| [ t.nome, t.id ] }, {}) %>
  </p>
  <p>
    <%= f.label :dataEntrada, "Data de entrada" %><br />
    <%= f.date_select :dataEntrada, :end_year => Time.now.year+10, :start_year => Time.now.year, :use_month_names => Reserva.meses %>
  </p>
  <p>
    <%= f.label :dataSaida, "Data de saida" %><br />
    <%= f.date_select :dataSaida, :end_year => Time.now.year+10, :start_year => Time.now.year, :use_month_names => Reserva.meses %>
  </p>
  <p>
    <%= f.submit "Inserir" %>
  </p>
<% end %>

<%= link_to 'Voltar', reservas_path %>

